package com.autoconfig.demo.config;

import com.autoconfig.demo.importFile.importConfig;
import com.peixun.common.demo.person.PersonDTO;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

/*@ConditionalOnMissingBean(value = {PersonDTO.class})*/
/*@EnableConfigurationProperties(value = )*/
@Configuration
//@ImportAutoConfiguration(importConfig.class)
@ComponentScan(basePackages = "com.autoconfig.demo.scan")
public class testAutoConfig {

    @Bean
    //@ConditionalOnBean(value = {PersonDTO.class})
    @ConditionalOnMissingBean(value = {PersonDTO.class})
    public PersonDTO personDTO(){
        PersonDTO p = new PersonDTO();
        p.setAge(20);
        p.setName("config注入");
        return p;
    }

}
